package ifosup.chat.metier;

import ifosup.chat.swing.IhmConversation;

import java.net.ServerSocket;
import java.net.Socket;

public class Server implements Runnable {

	ServerSocket serverSocket = null;
	public static Server instance ;
	public static Server getInstance() {
		if (instance == null){
			instance = new Server();
		}
		return instance;
	}

	private  Server() {
		super();
		Thread t = new Thread(this);
		t.start();
	}

	@Override
	public void run() {
		try {
			serverSocket = new ServerSocket(4444);
			
			while (true) {
				Socket s = serverSocket.accept();
				System.out.println("Server soket received 1");
				Client c = new Client(s);
				System.out.println("Server soket received 2");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
